<?php
require_once 'models/model.php';
class BlogModel{
	public $table = "NEWS";
	public $contb;
	public $title;
	public $content;
	public $views;
	public $date_created;
	public $user_name;
	public $category;
	public function __construct(){
		$this->contb = new Model();
		$this->contb->connDatabase();
		if ( sqlsrv_begin_transaction( $this->contb->conn ) === false )
		{
		     echo "Could not begin transaction.\n";
		     die( print_r( sqlsrv_errors(), true ));
		}
	}
	public function listNews(){
		$sql = "SELECT * FROM NEWS";
		$query = sqlsrv_query($this->contb->conn,$sql);
		while( $result = sqlsrv_fetch_array( $query, SQLSRV_FETCH_ASSOC) ) {
            $this->title = $result['title'];
    	}  
	}
}